package org.jackysoft.data;

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.lucene.analysis.Analyzer;
import org.jackysoft.config.CommonConfiguration;
import org.jackysoft.entity.BaseOption;
import org.jackysoft.entity.Identifiable;
import org.jackysoft.google.collection.ZTreeNode;
import org.jackysoft.query.Query;
import org.jackysoft.util.Page;
import org.springframework.dao.DataAccessException;

public abstract class AbstractNoSqlDataProvider<T extends Identifiable> implements IDataProvider<String,T>  {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2302565880151892050L;
	

	/**
	 * 
	 */
	protected Class<?> type = null;
	protected String luceneExpress;
	protected Analyzer chineseAnalyzer;
	protected CommonConfiguration config;
	
	
	
	
	protected abstract int listDataSize(SortInfo sortInfo, Map<String, Object> smap);

	protected abstract List<T> listData(int start, int size, boolean listAll, SortInfo sortInfo, Map<String, Object> smap) ;
	
	protected abstract List<T> searchData(int start, int size, boolean listAll,
			SortInfo sortInfo, Map<String, Object> smap) ;

	protected abstract int searchDataSize(SortInfo sortInfo, Map<String, Object> smap) ;
	
		
	public Class<?> getType() {
		return type;
	}
	public void setType(Class<?> type) {
		this.type = type;
	}
	public String getLuceneExpress() {
		return luceneExpress;
	}
	public void setLuceneExpress(String luceneExpress) {
		this.luceneExpress = luceneExpress;
	}
	public Analyzer getChineseAnalyzer() {
		return chineseAnalyzer;
	}
	
	
	
	
	@Override
	public void create(File[] files, String[] names)
			throws DataAccessException, IOException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void create(File file, String name) throws DataAccessException,
			IOException {
		// TODO Auto-generated method stub
		
	}
	
	

	@Override
	public Collection<ZTreeNode> ztree(T bean) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Page getsPage(Integer start, Integer rows) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public Collection<BaseOption> getOptions(Query query) {
		// TODO Auto-generated method stub
		return null;
	}
	
	
	
	@Resource
	public void setChineseAnalyzer(Analyzer chineseAnalyzer) {
		this.chineseAnalyzer = chineseAnalyzer;
	}
	public CommonConfiguration getConfig() {
		return config;
	}
	
	@Resource
	public void setConfig(CommonConfiguration config) {
		this.config = config;
	}
	

	
}
